import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PeopleRecordVO, PeopleRecordForm, PeopleRecordQuery } from '@/api/oce/peopleRecord/types';

/**
 * 查询编辑人员列表
 * @param query
 * @returns {*}
 */

export const listPeopleRecord = (query?: PeopleRecordQuery): AxiosPromise<PeopleRecordVO[]> => {
  return request({
    url: '/oce/materialEverydayCensus/listEdit',
    method: 'get',
    params: query
  });
};

/**
 * 查询编辑人员详细
 * @param id
 */
export const getPeopleRecord = (id: string | number): AxiosPromise<PeopleRecordVO> => {
  return request({
    url: '/oce/peopleRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增编辑人员
 * @param data
 */
export const addPeopleRecord = (data: PeopleRecordForm) => {
  return request({
    url: '/oce/peopleRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改编辑人员
 * @param data
 */
export const updatePeopleRecord = (data: PeopleRecordForm) => {
  return request({
    url: '/oce/peopleRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除编辑人员
 * @param id
 */
export const delPeopleRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oce/peopleRecord/' + id,
    method: 'delete'
  });
};
